﻿@model ModelStateDictionary
@{
    int statusCode = TempData.RestoreStatus();
    bool debugMode = Svc.Config(Par.In("WebPortal").Name("DebugMode"), Context.IsDebuggingEnabled);
}

@if(statusCode != 0)
{
    <div class="statusbar autohide-60">
        <ul>
            <li><span class="message">@T(Res.Name(statusCode))</span></li>
            @foreach(var state in Model)
            {
                foreach(var error in state.Value.Errors)
                {
                    string msg = error.Exception != null
                        ? error.Exception.Message
                        : error.ErrorMessage;
                    <li>
                        <span class="message error">@T(Res.In(state.Key).Name(msg))</span>
                        @if(error.Exception != null && debugMode)
                        {
                            <p class="trace exception-stack">@error.Exception.StackTrace</p>
                        }
                    </li>
                }
            }
        </ul>
    </div>
}